package com.hushao.aimi.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * @description: 订单明细信息
 * @author: 胡少
 * @create: 2018-06-03 17:26
 **/
@ApiModel("订单明细信息")
@Data
@Entity
public class AimiOrderItem implements Serializable {

    @Id
    @GenericGenerator(name = "uuid",strategy = "uuid")
    @GeneratedValue(generator = "uuid")
    @Column(length = 32)
    private String id;

    @ApiModelProperty("用户id")
    @Column(length = 32,nullable = false)
    private String userId;

    @ApiModelProperty("订单号")
    @Column(nullable = false)
    private Long orderNo;


    @ApiModelProperty("商品id")
    @Column(length = 32,nullable = false)
    private String productId;

    @ApiModelProperty("商品名称")
    @Column(length = 128,nullable = false)
    private String productName;

    @ApiModelProperty("商品图片URL地址")
    @Column(length = 512,nullable = false)
    private String productImage;

    @ApiModelProperty("商品规格")
    @Column(length = 64,nullable = false)
    private String productSpec;

    @ApiModelProperty("单价")
    @Column(nullable = false)
    private BigDecimal currentPrice;

    @ApiModelProperty("数量")
    @Column(nullable = false)
    private Integer number;

    @ApiModelProperty("总价格")
    @Column(nullable = false)
    private BigDecimal totalPrice;

    @ApiModelProperty("创建时间")
    @CreationTimestamp
    private Timestamp createTime;

    @ApiModelProperty("更新时间")
    @UpdateTimestamp
    private Timestamp updateTime;

    @ApiModelProperty("备注")
    @Column(length = 512)
    private String comment;

    public AimiOrderItem(String userId, Long orderNo, String productId, String productName, String productImage, String productSpec, BigDecimal currentPrice, Integer number, BigDecimal totalPrice, Timestamp createTime, Timestamp updateTime, String comment) {
        this.userId = userId;
        this.orderNo = orderNo;
        this.productId = productId;
        this.productName = productName;
        this.productImage = productImage;
        this.productSpec = productSpec;
        this.currentPrice = currentPrice;
        this.number = number;
        this.totalPrice = totalPrice;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.comment = comment;
    }
}
